/*
 * @Author: 9ilk 3535851673@qq.com
 * @Date: 2024-11-04 20:37:43
 * @LastEditors: 9ilk 3535851673@qq.com
 * @LastEditTime: 2024-11-04 20:47:03
 * @FilePath: /processpoll/Main.cc
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include"processpool.hpp"
#include"Task.hpp"

void Usage(string proc)
{
   cout << "Usage: " << proc << "process-num" << endl;
}

int main(int argc, char *argv[])
{
   if (argc != 2) // 表示没按规定格式用
   {
      Usage(argv[0]);
      return UsageError;
   }
   int num = stoi(argv[1]); // 要创建进程个数
   ProcessPool * pp = new ProcessPool(num,Worker);
   //1.创建进程池
   pp->InitPorcessPool();
   //2.派发任务
   pp->DispatchTask();
   //3.清理进程池
   pp->CleanProcessPool();

   delete pp;
   return 0;
}